<template>
  <div class="dynamic">
    <div class="gd">
      <div class="kong"></div>
      <div class="header">
        <!-- 重写 -->
        <router-link v-for="item in List" :to="item.url" :key="item">
          <div class="div">{{ item.name }}</div>
        </router-link>
        <!-- 结束 -->
        <div class="header-right">
          <van-icon name="search" class="icon" @click="search" />
          <!-- <img src="../../assets/img/" alt=""> -->
          <span @click="showPopup"
            ><img src="../../../public/img/登录.png" alt=""
          /></span>
        </div>
      </div>
    </div>
    <!-- 左侧弹出框 -->
    <van-popup
      v-model:show="show"
      position="left"
      :style="{ height: '100%', width: '85%' }"
      ><LeftPropWindow
    /></van-popup>
    <div class="hhh"></div>
    <router-view></router-view>
  </div>
</template>

<script>
import LeftPropWindow from "@/views/home/LeftPropWindow.vue";
import { ref } from "vue";
import { useRouter } from "vue-router";
export default {
  setup() {
    const router = useRouter();

    // 左侧弹出
    const show = ref(false);
    const showPopup = () => {
      show.value = true;
    };

    // 搜索
    const search = () => {
      router.push("/search");
    };

    return { show, showPopup, search };
  },
  data() {
    return {
      active: "",
      List: [
        {
          name: "关注",
          url: "/home/dynamic/attention",
        },
        {
          name: "推荐",
          url: "/home/dynamic/recommend",
        },
        {
          name: "论坛",
          url: "/home/dynamic/forum",
        },
      ],
    };
  },
  components: {
    LeftPropWindow,
  },
  methods: {
    // onClick(name) {
    //   // Toast(title);
    //   console.log(name);
    // },
    // change(i) {
    //   console.log(i);
    // },
  },
};
</script>
<style lang="less">
.dynamic {
  background: white;
  width: 100%;
  position: relative;
  .hhh {
    height: 55px;
  }
  .gd {
    width: 100%;
    position: fixed;
    top: 0px;
    left: 0;
    background: white;
    z-index: 66;
  }
  .van-tab__text--ellipsis {
    overflow: visible;
  }
  .header {
    // box-sizing: border-box;
    display: flex;
    height: 55px;
    // border-bottom: #999 1px solid;
    // justify-content: space-between;
    // justify-content: space-around;
    justify-content: center;
    align-items: center;
    a {
      margin-right: 38px;
    }
    // .hezi {
    //   width: 1px;
    //   height: 55px;
    // }
    // 重写样式
    .router-link-active {
      position: relative;
      &::after {
        content: "";
        width: 35px;
        height: 4px;
        background: #14b8c7;
        position: absolute;
        bottom: -12px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 2px;
      }
    }
    .div {
      color: #999;
      // font-weight: bold;
      font-size: 16px;
    }

    .router-link-active .div {
      color: #333;
      font-size: 20px;
    }

    // 结束

    // 上面是vant
    .header-right {
      width: 24%;
      display: flex;
      margin-left: 30px;
      justify-content: space-between;
      align-items: center;
      .icon {
        font-size: 20px;
        margin-right: 5px;
        margin-left: 14px;
        // margin-bottom: 7px;
        // line-height: 30px;
      }
      span {
        // margin-right: 15px;
        // border: black 1px solid;
        display: block;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        overflow: hidden;
        // margin-bottom: 7px;
        // box-sizing: border-box;
        img {
          height: 100%;
        }
      }
    }
  }
}
</style>
